package com.xiegang.apiboss.controller;

import com.xiegang.apiboss.service.CarService;
import com.xiegang.apiboss.service.DriverUserService;
import com.xiegang.internalcommon.dto.Car;
import com.xiegang.internalcommon.dto.DriverUser;
import com.xiegang.internalcommon.dto.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xieGang
 * @description
 * @date 2023/3/29 14:57
 **/
@RestController
@Slf4j
public class DriverUserController {

    @Autowired
    private DriverUserService driverUserService;

    @Autowired
    private CarService carService;

    @PostMapping("/driver-user")
    public ResponseResult addDriverUser(@RequestBody DriverUser driverUser) {
        log.info("addDriverUser: {}", driverUser);
        return driverUserService.addDriverUser(driverUser);
    }

    @PutMapping("/driver-user")
    public ResponseResult updateDriverUser(@RequestBody DriverUser driverUser) {
        log.info("updateDriverUser: {}", driverUser);
        return driverUserService.updateDriverUser(driverUser);
    }

    @PostMapping("/car")
    public ResponseResult addCar(@RequestBody Car car) {
        log.info("addCar: {}", car);
        return carService.addCar(car);
    }


}
